/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package com.nxu.campus.zhxy.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.nxu.campus.modules.system.domain.Dept;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.sql.Timestamp;

/**
* @website https://el-admin.vip
* @description /
* @author HWL
* @date 2022-04-15
**/
@Entity
@Data
@Table(name="zhxy_student")
public class ZhxyStudent implements Serializable {

    @Column(name = "grade",nullable = false)
    @NotNull
    @ApiModelProperty(value = "年级")
    private Integer grade;

    @OneToOne
    @JoinColumn(name = "major_id")
    @ApiModelProperty(value = "专业")
    private ZhxyMajor major;

    @OneToOne
    @JoinColumn(name = "classe_code")
    @ApiModelProperty(value = "班级")
    private ZhxyClasse classe;

    @OneToOne
    @JoinColumn(name = "dept_id")
    @ApiModelProperty(value = "院系")
    private Dept dept;

    @Id
    @Column(name = "student_id")
    @ApiModelProperty(value = "学号")
    private String studentId;

    @Column(name = "student_name",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "姓名")
    private String studentName;

    @Column(name = "gender",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "性别")
    private String gender;

    @Column(name = "ethnic")
    @ApiModelProperty(value = "民族")
    private String ethnic;

    @Column(name = "idno")
    @ApiModelProperty(value = "身份证号")
    private String idno;

    @Column(name = "dofb",nullable = false)
    @NotNull
    @ApiModelProperty(value = "出生日期")
    private Timestamp dofb;

    @Column(name = "phone")
    @ApiModelProperty(value = "手机号")
    private String phone;

    @Column(name = "email")
    @ApiModelProperty(value = "邮箱")
    private String email;

    @Column(name = "address")
    @ApiModelProperty(value = "地址")
    private String address;

    @Column(name = "atatus",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "学籍状态")
    private String atatus;

    @Column(name = "enrollmenttime")
    @ApiModelProperty(value = "入校时间")
    private Timestamp enrollmenttime;

    public void copy(ZhxyStudent source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
